﻿using PetaPoco;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Cxuu.Models
{
    [TableName("cxuu_article_cate")]
    [PrimaryKey("Id", AutoIncrement = true)]
    public class ArticleCate
    {
        public int Id { get; set; }

        public int Pid { get; set; }

        public string Name { get; set; }

        public bool Type { get; set; }

        public string Theme { get; set; }

        public int Sort { get; set; }

        public int Num { get; set; }

    }

    public class EditArticleCate
    {
        [Display(Name = "上级栏目")]
        public int Pid { get; set; }
        [Display(Name = "栏目名称")]
        [Required(ErrorMessage = "未填写栏目名称")]
        public string Name { get; set; }
        [Display(Name = "栏目类型")]
        [Required(ErrorMessage = "未选择类型")]
        public bool Type { get; set; }
        [Display(Name = "自定义模板")]
        public string Theme { get; set; }
        [Display(Name = "排序")]
        public int Sort { get; set; } = 0;
        [Display(Name = "前台显示条数")]
        public int Num { get; set; } = 15;
    }

    public class ViewArticleAndCate
    {
        public int Id { get; set; }
        public int Cid { get; set; }
        public string Title { get; set; }
        public string Img { get; set; }
        public int Imgbl { get; set; }
        public string CateName { get; set; }
        public string Examine { get; set; }
        public string Groupname { get; set; }
        public string Nickname { get; set; }
        public DateTime Time { get; set; }
        public int Status { get; set; }
        public int AttA { get; set; }
        public int AttB { get; set; }
        public int AttC { get; set; }

    }

    public class ViewArticleCate
    {
        public int Id { get; set; }

        public int Pid { get; set; }

        public string Title { get; set; }
        public bool Type { get; set; }

        public string Theme { get; set; }

        public int Sort { get; set; }

        public int Num { get; set; }

        public int Depth { get; set; }
        /// <summary>
        /// 节点展开
        /// </summary>
        public string Spread { get; set; }
        /// <summary>
        /// 节点是否为禁用状态。默认 false
        /// </summary>
        public string Disabled { get; set; }

        public int ChildrenCount { get; set; }
        public List<ViewArticleCate> Children { set; get; } = new();


    }
}